package com.school.lab.web.action.front;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.school.lab.domain.User;
import com.school.lab.web.WebConstants;

public class AuthorUserInterceptor extends MethodFilterInterceptor{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@SuppressWarnings("unchecked")
	@Override
	protected String doIntercept(ActionInvocation ai) throws Exception {
		Map session = ai.getInvocationContext().getSession();
		User user = (User) session.get(WebConstants.SESSION_STUDENT);
		if(user!=null&&("".equals(user.getRealName())||user.getRealName()==null)){
			return "updateUser";
		}else{
			return ai.invoke();
		}
	}

}
